<?php

class User_Page_Main_Exception extends Page_Main_Exception {}
class User_Page_Main_Invalid_Exception extends User_Page_Main_Exception {}

class User_Page_Main extends Page_Main {

	protected function __construct($args){
		parent::__construct($args);
		$this->user = Authentication::getInstance()->user();
		if($this->user instanceof User_Guest){
			throw new Page_User_Invalid_Exception($page, $this->user);
		}
		$language = $this->user->language();
		$this->title = sprintf($language->translate(array('user','page','title')), $this->user->name());
	}

	public function rid($array = array()){
		return array_merge(
			array('user'),
			$array
		);
	}

	public static function Load($args){
		Module::LoadModule('authentication');

		return new User_Page_Main($args);
	}

	public function run(){

	}

	public function output(){
		$parent = parent::output();
		$parent->module = Output::getInstance()->Template(array('user','page'));
		$parent->module->title = $this->title;
		return $parent;
	}

}
